<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>

<div class="modal-dialog x-modal-dialog" style="width: 650px; margin-top: 100px;">

  <div class="modal-content">

    <div class="modal-header x-breadcrumb no-bottom-border clearfix">

      <h2><i class="glyphicon glyphicon-fire" title="添加折扣"></i>&nbsp;&nbsp;<span>代言人详情&nbsp;-&nbsp;添加折扣</span></h2>

      <button type="button" class="close" data-dismiss="modal">&times;</button>

    </div>
    
    <form class="form-horizontal" method="POST" action="${ctx.host}/agents/${agent.id}/agent-discounts" data-validate="true">

      <div class="modal-body">

        <div class="form-group x-form-group">
          <label class="col-xs-4 control-label">折扣方式</label>
          <div class="col-xs-6 pull-left">
            <select name="discountType" class="select2 form-control" data-validate="required">
              <option value=""></option>
              <c:forEach var="discountType" items="${enums['discountType']}">
                <option value="${discountType.alias}">${discountType.description}</option>
              </c:forEach>
            </select>
          </div>
        </div>
        
        <div class="form-group x-form-group payment hide">
          <label class="col-xs-4 control-label">优惠</label>
          <div class="col-xs-6 pull-left">
            <input type="text" class="form-control" name="payment" value="" data-validate="required|discount_validate" placeholder="可输入多个，金额之间以逗号隔开"/>
          </div>
        </div>
        
        <div class="form-group x-form-group discount">
          <label class="col-xs-4 control-label">优惠</label>
          <div class="col-xs-6 pull-left">
            <input type="text" class="form-control" name="discount" value="" data-validate="required|number|percentage_validate" placeholder="优惠"/>
          </div>
        </div>
        
        <div class="form-group x-form-group">
          <label class="col-xs-4 control-label">推荐奖励</label>
          <div class="col-xs-6 pull-left">
            <input type="text" class="form-control" name="commission" value="" data-validate="required|discount_validate" placeholder="可输入多个，金额之间以逗号隔开"/>
          </div>
        </div>
        
      </div>

      <div class="modal-footer">
        <button type="submit" class="btn btn-success btn-shadow btn-shadow-success x-btn">确定</button>&nbsp;&nbsp;&nbsp;&nbsp;
        <button type="button" class="btn btn-default btn-shadow btn-shadow-default x-btn" data-dismiss="modal">取消</button>
      </div>

    </form>

  </div>
  

</div>
<script type="text/javascript">
  $(function() {
    
    $('select[name="discountType"]').select2({
      placeholder : '请选择折扣方式',
      minimumResultsForSearch : -1,
      allowClear : true,
      width: '100%'
     });
    
  })
</script>

